<?php

class EmailController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }

    public function sendmailAction()
    {
        // action body
        
		$MailObj = new Zend_Mail();
        
		$emailMessage = "Hey, this is a Zend_Mail–created e-mail!";
        
		$fromEmail = "dibieo@gmail.com";
        
		$fromFullName = "Ovo";
        
		
        
		$to = "ovoalways@yahoo.com";
        
		$subject = "This is an example";
        
		$MailObj->setBodyText($emailMessage);
        
		$MailObj->setFrom($fromEmail, $fromFullName);
        
		$MailObj->addTo($to);
        
		$MailObj->setSubject($subject);
        
		try{
        
		$MailObj->send();
        
		echo "E-mail sent successfully";
        
		}catch(Zend_Mail_Exception $e){
        
		//Your Error message here.
        
		 echo "Message sending failed";
        
		}
        
		//Suppress the view.
        
		$this->_helper->viewRenderer->setNoRender();
    }

    public function smtpAction()
    {
		        // action body
				//Create SMTP connection Object
		$configInfo = array('auth' => 'login',
		'ssl' => 'tls',
		
		'username' => 'dibieo',
		'password' => 'america100',
		'port' => '587');
		$smtpHost = new Zend_Mail_Transport_Smtp('smtp.gmail.com',
		$configInfo);
		//Create Zend_Mail object.
		$MailObj = new Zend_Mail();
		//Initialize parameters.
		$emailMessage = "Hey, this is a Zend_Mail–created e-mail!";
		$fromEmail = "dibieo@gmail.com";
		$fromFullName = "Ovo";
		$to = "ovoalways@yahoo.com";
		$subject = "Test";
		$MailObj->setBodyText($emailMessage);
		$MailObj->setFrom($fromEmail, $fromFullName);
		$MailObj->addTo($to);
		$MailObj->setSubject($subject);
		//Send Email using transport protocol.
		try{
				$MailObj->send($smtpHost);
				echo "Email sent successfully";
		}catch(Zend_Mail_Exception $e){
		//Your error message here.
		echo $e->getMessage();
		}
		//Suppress the view.
		$this->_helper->viewRenderer->setNoRender();
		}
    


}





